/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package preka.util;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

/**
 *
 * @author vhbarros
 */
public class CSVWriter {
    
    private FileOutputStream m_file;

    public CSVWriter() {

    }

    public CSVWriter(String fileLocation) throws FileNotFoundException {
        m_file = new FileOutputStream(fileLocation);
    }


    public void newFile(String fileLocation) throws FileNotFoundException {
        m_file = new FileOutputStream(fileLocation);
    }

    public void writeLine(String field1, String field2, String field3) throws IOException {
        String line = field1 +";"+
                      field2 +";"+
                      field3 +"\n";
        m_file.write(line.getBytes());
    }

    public void closeFile() throws IOException {
        m_file.flush();
        m_file.close();
    }

}
